#! /bin/bash

echo "===== Starting build ====="
echo "Timestamp"
date -u
echo "=========================="
echo

echo "===== Updating from SVN ====="
svn update
cd src

echo
echo "===== Making JETI Version ====="
echo ">>> cleaning"
make clean
echo ">>>  making"
make EXT=JETI
echo ">>>  moving"
mv er9x.hex ../er9x-jeti.hex

echo
echo "===== Making FRSKY Version ====="
echo ">>> cleaning"
make clean
echo ">>>  making"
make EXT=FRSKY TEMPLATES=NO
echo ">>>  moving"
mv er9x.hex ../er9x-frsky.hex



echo
echo "===== Making FRSKY - NOHELI/NOTEMPLATE Version ====="
echo ">>> cleaning"
make clean
echo ">>>  making"
make EXT=FRSKY TEMPLATES=NO HELI=NO
echo ">>>  moving"
mv er9x.hex ../er9x-frsky-noht.hex



echo
echo "===== Making ARDUPILOT Version ====="
echo ">>> cleaning"
make clean
echo ">>>  making"
make EXT=ARDUPILOT
echo ">>>  moving"
mv er9x.hex ../er9x-ardupilot.hex

echo
echo "===== Making nmea Version ====="
echo ">>> cleaning"
make clean
echo ">>>  making"
make EXT=NMEA
echo ">>>  moving"
mv er9x.hex ../er9x-nmea.hex


echo
echo "===== Making MAIN - NOHELI/NOTEMPLATE Version ====="
echo ">>> cleaning"
make clean
echo ">>>  making"
make TEMPLATES=NO HELI=NO
echo ">>>  moving"
mv er9x.hex ../er9x-noht.hex

echo
echo "===== Making MAIN Version ====="
echo ">>> cleaning"
make clean
echo ">>>  making"
make
echo ">>>  moving"
mv er9x.hex ../er9x.hex

echo ">>> cleaning"
make clean 

cd ..
